package com.bcst.aspect.annotation;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

/**
 * @description 欢迎关注公众号 编程识堂,每日更新技术相关文章，关注我不迷路
 * @author 小堂
 * @date 2023/8/31 0031 10:32
 * @description 注解改造
 */
@Aspect
@Component
public class LogAspect {

    @Around("execution(* com.bcst.service.*.*.*(..))")
    public Object log(ProceedingJoinPoint joinPoint) throws Throwable {
        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
        System.out.println("注解方式 execute method:"+method.getName());
        return joinPoint.proceed();
    }
}
